﻿<%@ page contentType="text/html; charset=UTF-8" language="java"
	import="java.util.*,org.yoao.crm.acl.ACLTool,org.yoao.crm.bean.StaticBean,org.yoao.crm.page.framework.IViewPageService,org.yoao.crm.page.framework.ViewPageHelper,org.yoao.crm.bean.Customer"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";

	org.yoao.crm.bean.Session userSession = (org.yoao.crm.bean.Session) session
			.getAttribute("userSession");
	String actionPermission = userSession.getActionPermission();

	IViewPageService customerPage = (IViewPageService) session
			.getAttribute(ViewPageHelper.SESSION_PAGE);

	List list = (List) request.getAttribute("CUSTOMERLIST");

	String roleId = (String) request.getAttribute("ROLEID");

	String searchBirthDay = (String) request
			.getAttribute("searchBirthDay");
	if (searchBirthDay == null)
		searchBirthDay = "";
%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>CRM-客户列表</title>
		<jsp:include page="../public/publicJs.jsp" flush="false"></jsp:include>
		<script src="<%=basePath%>js/calendar.js">
</script>
		<script type="text/javascript">
var preTr = null;
var preColor = "";
function changeTrColor() {
	try {
		var tag = event.srcElement;
		while (tag.tagName != "TR")
			tag = tag.parentElement;
		switch (event.type) {
		case "mouseover":
			preColor = tag.currentStyle.backgroundColor;
			if (tag.currentStyle.highLightColor)
				tag.style.background = tag.currentStyle.highLightColor;
			else
				tag.style.background = "#FFFF00";
			break;
		case "mouseout":
			if (preTr != tag)
				tag.style.background = preColor;
			break;
		}
	} catch (E) {
	}
}
</script>
	</head>

	<body topmargin="0" leftmargin="0"
		onLoad="setDivHeight('divList', -107);">
		<div id="div_load"
			style='display: block; background: #FFFFFF; width: 240px; height: 12px; margin-top: -120px; margin-left: -200px; left: 50%; top: 50%; position: absolute; padding: 5px 5px 5px 5px; z-index: 1'>
			<img src="<%=basePath%>images/loading.gif" class="icon1"
				align="absmiddle" />
			数据加载中,请稍后...
		</div>
		<table class="maintab_content_table" border="0" width="100%"
			cellspacing="0" cellpadding="0" height="25">
			<tr class="tree_title_txt">
				<td nowrap width="100%" class="tree_title_txt" valign="middle"
					id="cwCellTopTitTxt">
					<font color="#154288">今日生日客户 </font>
				</td>
			</tr>
		</table>

		<div id="ds"
			style="display: none; background: #EBEBEB; width: 100px; height: 20px; left: 50%; top: 50%; position: absolute; padding: 5px 5px 5px 5px; z-index: 1">
			<font color="#FF0000"><img
					src="<%=basePath%>images/loading.gif" alt="数据加载中" align="absmiddle" />数据加载中...</font>
		</div>
		<div style="width: 100%;">
			<fieldset
				style="width: 100%; TEXT-ALIGN: center; margin: 0px 5px 0px 5px;">
				<legend>
					&nbsp;搜索
					<img name="Changeicon" border="0"
						src="<%=basePath%>images/jt_b.gif"
						onClick="javascript:fieldsetHidden();" style="cursor: hand"
						title="显示/隐藏内容">
					&nbsp;
				</legend>
				<form name="searchForm"
					action="<%=basePath%>customer.crm?method=birthDay" method="post">
					<center>
						<table border="0" width="100%" cellspacing="5" cellpadding="0">
							<tr>
								<td nowrap style="width: 60px">
									出生日期:
								</td>
								<td>
									<input name="searchBirthDay" style="width: 200px"
										class="text_220" type="text" size="15" readonly maxlength="10"
										value="<%=searchBirthDay%>" />
									<img onClick="calendar('', 'searchBirthDay');return false"
										style="cursor: pointer;"
										src="<%=basePath%>images/tbtn_overtime.gif" width="20"
										height="19" border="0" align="absmiddle">
									&nbsp;&nbsp;&nbsp;&nbsp;
									<input name="image" type="image"
										src="<%=basePath%>images/tbtn_searh.gif" alt="查询"
										align="absmiddle" onclick="searchForm.submit();">
								</td>
							</tr>
						</table>
					</center>
				</form>
			</fieldset>
		</div>

		<form action="<%=basePath%>customer.crm?method=birthDay"
			name="viewForm" method="post">
			<input name="searchBirthDay" type="hidden"
				value="<%=searchBirthDay%>">

			<table border="0" width="100%" height="25" cellspacing="0"
				cellpadding="0">
				<tr class="maintab">
					<td width="1%" align="center" valign="middle" id="cwCellTopTitTxt">
						<input type="checkbox" onClick="selectAction('itemselect')"
							value="1" />
					</td>
					<%
						if (ACLTool.isSms(actionPermission)) {
					%>
					<td width="2%">
						<a href="#" accesskey="n"
							onClick="dataHander('sms','<%=basePath%>sms.crm?method=send&id=', viewForm.itemselect);"><img
								align="absmiddle" src="<%=basePath%>images/sbtn_sel.gif"
								alt="发送短信(Alt+S)" align="absmiddle"> </a>
					</td>
					<%
						}
					%>

					<td nowrap width="68%" align="right">
						<input id="<%=ViewPageHelper.PAGE_ACTION%>"
							name="<%=ViewPageHelper.PAGE_ACTION%>" type="hidden" value="" />
						共
						<%=customerPage.getTotalRows()%>条 /
						<%=customerPage.getPageCount()%>
						页
						<%
							if (customerPage.getPageIndex() > 1) {
						%>
						<img align="absmiddle" style="cursor: pointer;"
							onClick="goPage('FIRST_PAGE')"
							src="<%=basePath%>images/ico_first.gif" alt="首页" border="0" />
						<img align="absmiddle" style="cursor: pointer;"
							onClick="goPage('PREVIOUS_PAGE')"
							src="<%=basePath%>images/ico_prev.gif" alt="上一页" border="0" />
						<%
							} else {
						%>
						<img align="absmiddle" style="filter: Gray;"
							src="<%=basePath%>images/ico_first.gif" alt="首页" border="0" />
						<img align="absmiddle" style="filter: Gray;"
							src="<%=basePath%>images/ico_prev.gif" alt="上一页" border="0" />
						<%
							}
						%>
						第
						<font color="red"><%=customerPage.getPageIndex()%></font> 页
						<%
							if (customerPage.getPageIndex() < customerPage.getPageCount()) {
						%>
						<img align="absmiddle" style="cursor: pointer;"
							onClick="goPage('NEXT_PAGE')"
							src="<%=basePath%>images/ico_next.gif" alt="下一页" border="0" />
						<img align="absmiddle" style="cursor: pointer;"
							onClick="goPage('LAST_PAGE')"
							src="<%=basePath%>images/ico_last.gif" alt="尾页" border="0/">
						<%
							} else {
						%>
						<img align="absmiddle" style="filter: Gray;"
							src="<%=basePath%>images/ico_next.gif" alt="下一页" border="0" />
						<img align="absmiddle" style="filter: Gray;"
							src="<%=basePath%>images/ico_last.gif" alt="尾页" border="0" />
						<%
							}
						%>
					</td>
					<td nowrap width="1%">
						<img align="absmiddle" src="<%=basePath%>images/sbtn_split.gif" />
					</td>
					<td nowrap width="8%">
						转到&nbsp;
						<input id="<%=ViewPageHelper.PAGE_NO%>"
							name="<%=ViewPageHelper.PAGE_NO%>" type="text" size="2"
							value="<%=customerPage.getPageIndex()%>"
							onKeyPress="javascript:if(event.keyCode == 13){goPage('jump');}" />
						&nbsp;页
						<img align="absmiddle" style="cursor: pointer;"
							onClick="goPage('jump')" src="<%=basePath%>images/goto.gif"
							alt="执行" border="0" align="absmiddle">
					</td>
				</tr>
			</table>

			<div id="divList"
				style="vertical-align: top; width: 100%; overflow: auto;">
				<table border="0" style="border-collapse: collapse;" align="center"
					cellpadding="0" cellspacing="0" width="100%"
					class="maintab_content_table">
					<tr class="maintab_content_table_title">
						<th width="1%"></th>
						<th align="center" nowrap>
							客户码
						</th>
						<th align="center" nowrap>
							联系人
						</th>
						<th align="center" nowrap>
							出生日期
						</th>
						<th align="center" nowrap>
							省份
						</th>
						<th align="center" nowrap>
							城市
						</th>
						<th align="center" nowrap>
							手机
						</th>
						<th align="center" nowrap>
							QQ
						</th>
						<th align="center" nowrap>
							E-mail
						</th>
						<th align="center" nowrap>
							服务人员
						</th>
						<th align="center" nowrap>
							创建时间
						</th>
						<th align="center" nowrap>
							备注
						</th>
					</tr>
					<%
						if (list != null) {
							int size = list.size();
							for (int i = 0; i < size; i++) {
								Customer customer = (Customer) list.get(i);
					%>
					<tr onMouseOver="changeTrColor()" onMouseOut="changeTrColor()"
						title="<%=customer.getCustomerName()%>">
						<td nowrap align="center">
							<input class="rd" type="checkbox" name="itemselect"
								value="<%=customer.getId()%>" />
						</td>
						<td nowrap>
							<%=customer.getCustomerId()%>
						</td>
						<td nowrap><%=customer.getCustomerName()%></td>
						<td nowrap><%=customer.getBirthday()%></td>
						<td nowrap><%=customer.getProvince()%></td>
						<td nowrap><%=customer.getCity()%></td>
						<td nowrap><%=customer.getMobile()%></td>
						<td nowrap><%=customer.getQQ()%></td>
						<td nowrap><%=customer.getEmail()%></td>
						<td nowrap><%=customer.getUserSno()%></td>
						<td nowrap><%=customer.getCreateTime()%></td>
						<td nowrap><%=customer.getMemo()%></td>
					</tr>
					<%
						}
						}
					%>
				</table>
			</div>
		</form>
	</body>
</html>
<script>
document.getElementById("div_load").style.display = "none";</script>